home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: jatco@ix.netcom.com (jatco)
- Newsgroups: comp.lang.c++
- Subject: The JTC NEWS LETTER - A Forum For IDAPI Developers
- Date: Fri, 16 Feb 1996 04:14:10 GMT
- Organization: Netcom
- Message-ID: <4g0lr6$e06@cloner2.ix.netcom.com>
- NNTP-Posting-Host: ix-nyc14-09.ix.netcom.com
- X-NETCOM-Date: Thu Feb 15 5:15:18 PM PST 1996
- X-Newsreader: Forte Free Agent 1.0.82
-
- ----------------------------------------------------------------------
- _______ _______ _____ February 15, 1996
- |__ __|__ __ / ____| ___ __
- | | | | | | / _ \ / /______ __ ________
- _ | | | | | | / / \ \ / / ___/\ \ / \ / / ___/
- | |_| | | | | |____ / / \ / / /__/ \ / /\ / (__ ) Letter
- \____| |_| \_____| /_/ \_/____/ \_/ \_/____/
- Jatco Tec. Corp. Volume 1, Number 1
- ----------------------------------------------------------------------
-
-
- Highlights include:
-
- o The JTC NEWS LETTER - A Forum For IDAPI Developers
- o How To Subscribe To The JTC NEWS LETTER
- o How To Contribute Content To The JTC NEWS LETTER
- o Thumbs Up For IDAPI And The BDE
- o Getting Down To Business - Differences Between IDAPI Versions
- o A Final Word
-
-
- The JTC NEWS LETTER - A Forum For IDAPI Developers
- +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-
-
- As you may know, JTC developed Jatco OIL(TM), a commercialy available
- C++ class library for IDAPI, to support C++ developers using the
- Borland Database Engine and IDAPI in their database development. Our
- customers tell us it is a great product and, through their feedback
- and suggestions, have helped us to make it an even better product. We
- thought it would be a good idea to provide a common space where we
- could publish some of the experiences, suggestions, comments, and
- ideas that our customers, and for that matter all IDAPI developers
- (whether or not you are using Jatco OIL) have to share. Therefor, we
- decided to put together this newsletter so that we could share some
- of this information with you. But we can't do it alone. We need you
- to contribute and share with your fellow developers your own
- experiences developing with the BDE, IDAPI and OIL. Your
- contributions can be anything from a code snipit to an article.
-
-
- How To Subscribe To The JTC NEWS LETTER
- +--+--+--+--+--+--+--+--+--+--+--+--+--
-
- If you would like to subscribe and receive future editions of the JTC
- NEWS LETTER then email us at jatco@ix.netcom.com. Include the text
- "SUBSCRIBE" in the body of the email and we will then put you on our
- email distribution list.
-
-
- How To Contribute Content To The JTC NEW LETTER
- +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-
-
- To contribute content to the newsletter send it to us at our email
- address at jatco@ix.netcom.com. Include your name, company name,
- email address and the text "CONTRIBUTE CONTENT" in the body of the
- email. We are investigating alternate methods of providing content
- for the future but for now we will only accept content as ASCII text.
-
- If you are providing code samples along with your content, we will
- accept C, C++ and Delphi Pascal in native IDAPI and OIL. Also, try to
- keep the code samples as small and as concise as possible.
-
- Pleas note that we do reserve the right to edit all content.
-
-
- Thumbs Up For IDAPI And The BDE
- +--+--+--+--+--+--+--+--+--+--+
-
- You have spent weeks, maybe months, getting your program's screens
- and graphics to look just right. Now, all that is left to be done is
- to throw in some code to connect your program to its data, right?
- Wrong!
-
- No one said it was going to be easy. Database programming can be a
- real pain. First, you have to decide if your app will use
- client/server, network/multi-user, or a local database architecture.
- Then you have to decide which database format you want to use - dBASE
- or Paradox if you go local or network/multi-user, Sybase, MS SQL
- Server, Oracle, Informix or Interbase if you go client/server.
- Lastly, you have to decide between using the native api (like dblib)
- supplied by the database vendor to access your data or if you will
- opt for a layer of insulation and use either ODBC or IDAPI.
-
- There is a lot to be said for opting to insulate your applications
- from a specific vendor's api. For one thing, choosing to code to the
- vendor's api obviously locks you into their database product. It also
- makes moving to a different architecture somewhere down the road
- (moving from network/multi-user to client/server for example) a major
- rewrite of your application. Using heterogeneous databases in one
- application would mean you would have to use two different apis in
- the same program.
-
- So what is a good programmer to do? Our experience has shown us that
- the more you insulate yourselves from a specific vendor's product and
- api the happier you and your customers will be. Unless you are
- developing a real-time, extremely high volume transaction oriented
- system, using a layer of abstraction is your smartest choice.
-
- But which abstraction layer should you chose, ODBC or IDAPI? If you
- are using dBASE of Paradox, go with IDAPI because its native drivers
- are the same ones used by Borland in their dBASE and Paradox for
- Windows products. Also, because IDAPI is also ODBC compliant it
- therefore can use any ODBC driver.
-
- We believe, from our own experience, that IDAPI is also a better
- choice over ODBC if you are developing a client/server based app
- because IDAPI's native api also supports pass-through SQL allowing
- you to bypass IDAPI altogether when querying for data. Mixing ANSI
- SQL with IDAPI's strong navigational api provides a powerful command
- set at your disposal.
-
-
- Getting Down To Business - Differences between IDAPI versions
- +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-
- Borland first introduced the IDAPI sdk with its Database Tools for
- the BC++ V4.0. Since this initial release, both Delphi and BC++ V4.5
- shipped with an updated version of the BDE.
-
- From our own experiences, we have found some interesting differences
- between these versions and we thought we would pass them on to you so
- that you won't trip over them. We also have some suggestions as to
- how to avoid some of these trip-wires so that your apps won't be
- impacted by changes in these and future versions of the BDE.
-
-
- Database Table Names In Query Statements
- ----------------------------------------
-
- In the version of the IDAPI sdk that shipped with BC++ V4.0 you were
- able to omit the table name qualifier in a query statement and the
- BDE accepted it without it. However, with the version of the BDE that
- shipped with Delphi and BC++ V4.5 this isn't the case. The following
- code, which uses the Jatco OIL C++ IDAPI class library, demonstrates
- the problem:
-
- const char * sql = "SELECT * FROM AUTO";
- pStatement stmt = new Statement((pCHAR)sql, qrylangSQL);
- pQuery qry = new Query(*stmt, *ptheAutoLogDatabase);
- qry->xDbiQExecDirect();
-
- The above works with the version of the BDE that shipped with BC++
- V4.0 and BC++ V4.5, but it doesn't work with the version that shiped
- with Delphi V1.0.
-
- The solution to this problem is to include the table name qualifier
- and code it as the following:
-
- const char * sql = "SELECT * FROM \"AUTO.DB\"";
- pStatement stmt = new Statement((pCHAR)sql, qrylangSQL);
- pQuery qry = new Query(*stmt, *ptheAutoLogDatabase);
- qry->xDbiQExecDirect();
-
-
- Result Column Names Returned For Aggregates Functions
- -----------------------------------------------------
-
- Jatco OIL allows you to read and write values from a cursor's record
- buffer using the name of the column as an identifier. It seems that
- Borland changed the column names for aggregate values (aggregate
- values are the values that are returned by the aggregate functions
- SUM, AVG, MIN, MAX AND COUNT) returned from a query in its newer
- version of the BDE (Delphi, BC++ V4.5). In the previous version of
- the BDE the column name returned for the aggregate COUNT(Id) on a
- local table was "Count of Id". Not so in the newer version of the
- BDE. The following code, which uses the Jatco OIL C++ IDAPI class
- library, demonstrates the problem:
-
- const char *sql =
- "SELECT COUNT(Id) FROM \"AUTO.DB\" A WHERE A.ALIAS = \"%s\"";
- sprintf(szBuffer, sql, szAlias);
- pStatement stmt = new Statement((pCHAR)szBuffer, qrylangSQL);
- pQuery qry = new Query(*stmt, *ptheAutoLogDatabase);
- qry->xDbiQExecDirect();
- qry->ResultCur()->SetupCursor();
- qry->ResultCur()->xDbiGetNextRecord();
- FLOAT count = 0;
- qry->ResultCur()->xDbiGetField("Count of Id",(pBYTE)&count);
-
- The above works with the version of the BDE that shipped with BC++
- V4.0 and BC++ V4.5, but it doesn't work with the version that shiped
- with Delphi V1.0.
-
- The solution is that, rather than hard coding the column name in the
- Cursor method xDbiGetField, use the overloaded version of this method
- that takes an ordinal number for the column you want to read and a
- pointer to the record buffer. This frees you from having to know the
- column names of aggregate values. The following code demonstrates the
- better way to deal with returned aggregate values:
-
- const char *sql =
- "SELECT COUNT(Id) FROM \"AUTO.DB\" A WHERE A.ALIAS = \"%s\"";
- sprintf(szBuffer, sql, szAlias);
- pStatement stmt = new Statement((pCHAR)szBuffer, qrylangSQL);
- pQuery qry = new Query(*stmt, *ptheAutoLogDatabase);
- qry->xDbiQExecDirect();
- qry->ResultCur()->SetupCursor();
- qry->ResultCur()->xDbiGetNextRecord();
- FLOAT count = 0;
- qry->ResultCur()->xDbiGetField(1, qry->ResultCur()->RecBuf(),
- (pBYTE)&count);
-
-
- A Final Word
- +--+--+--+--
-
- Now that Borland has announcded Delphi 2.0 and Borland C++ for Win96
- and WinNT we hope to cover the 32 bit version of the BDE/IDAPI in
- future issues of The JTC NEWS LETTER. We would like to hear your
- ideas and comments. Email us at jatco@ix.netcom.com.
-
- For information about Jatco OIL(TM) (Object IDAPI Library), our
- commercial C++ class library for IDAPI, you can contact us by email
- at jatco@ix.netcom.com or by phone at 718 445-2235 between the hours
- of 9a and 5p, Monday through Friday, eastern standard time.
-
- Thanks for spending some time with us and we look forward to your
- joining us in making The JTC NEWS LETTER a forum for all IDAPI
- developers.
-
- ----------------------------------------------------------------------
- End JTC NEWS LETTER 1.1 2/15/96
- ----------------------------------------------------------------------
-
-